package cal;

import com.alibaba.fastjson.JSONObject;
import java.util.Random;
import java.util.Date;

public class Road {
    public String roadname;
    public String polyline;
    public String direction;
    public boolean istunnel;
    public boolean isbridge;
    public String material;
    public double weight;
    public double width;
    public double height;
    public int planeness;
    public double slope;
    public double turningCircle;
    public double lng;
    public double lat;
    public double altitude;
    public String level;
    public double limitSpeed;
    public String Timelimit1;
    public String Timelimit2;
//    public Date TStringmelimit1;
//    public Date Timelimit2;
    public String status;
    public Road(){
        roadname = "nanjiaolu";
                polyline = "116.481882,39.948353, 116.481882, 38.348353";
                direction ="null";
                istunnel = false;
                isbridge = false;
                material = "concrete";
                weight = 120.00;
                width = 12.00;
                height = 7.00;
                planeness = 3;
                slope = 15;
                turningCircle = 10;
                lng = 116.481882;
                lat = 39.948353;
                altitude = 43.05;
                level = "normal";
                limitSpeed = 80;
                Timelimit1 ="null";
                Timelimit2 ="null";
                status = "normal";
    }

    public Road(String name){
        roadname = name;
        polyline = "116.481882,39.948353, 116.481882, 38.348353";
        direction ="null";
        istunnel = false;
        isbridge = false;
        material = "concrete";
        weight = getrand(100);
        width = getrand(20);
        height = getrand(20);
        planeness = 3;
        slope = 15;
        turningCircle = 10;
        lng = 116.481882;
        lat = 39.948353;
        altitude = 43.05;
        level = "normal";
        limitSpeed = 80;
        Timelimit1 ="null";
        Timelimit2 ="null";
        status = "normal";
    }
    
    /**
    * @description 
    * @params [road]
    * @return  
    * @author  lj
    * @date  2020/7/21 20:13
    *
    */
    public Road(JSONObject road){
        super();
        roadname = road.getString("roadname");
        polyline = road.getString("polyline");
        direction = road.getString("roadname");
        istunnel = road.getBoolean("istunnel");
        isbridge = road.getBoolean("istunnel");
        material = road.getString("material");
        weight = road.getDouble("weight");
        width = road.getDouble("width");
        height = road.getDouble("height");
        planeness = road.getInteger("planeness");
        slope = road.getDouble("slope");
        turningCircle = road.getDouble("turningCircle");
        lng = road.getDouble("lng");
        lat = road.getDouble("lat");
        altitude = road.getDouble("altitude");
        level = road.getString("level");

        limitSpeed = road.getDouble("limitSpeed");
//        Timelimit1 = road.getDate("Timelimit1");
//        Timelimit2 = road.getDate("Timelimit2");
        Timelimit1 = road.getString("Timelimit1");
        Timelimit2 = road.getString("Timelimit2");
        status = road.getString("status");
    }
    public static double getrand(int value)
    {
        long t = System.currentTimeMillis();//获得当前时间的毫秒数
        Random r = new Random(t);//作为种子数传入到Random的构造器中

        return  r.nextInt(value);
    }
}
